package io;

import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.PrintStream;

/*
重定向标准输出流
 */
public class RedirectOut {

    public static void main(String[] args) throws IOException {

        PrintStream printStream = new PrintStream(new FileOutputStream("out.txt"));
        System.setOut(printStream);
        System.out.println("普通字符串");
        System.out.println("shiqi");
        System.out.println(new RedirectOut());
        printStream.close();
    }
}
